public class 实例内部类 {
    public static void main(String[] args) {
        OuterClass Out = new OuterClass();
        OuterClass.InnerClass innerClass = Out.new InnerClass();

        innerClass.test();

    }
}

class OuterClass{
    public int data1 = 1;
    private final int data2 = 2;
    public static int data3 = 3;
    /*
     * 实例内部类:定义在类的内部,方法的外部
     */
    class InnerClass{
        public int data1 = 10;
        public int data4 = 4;
        private final int data5 = 5;
        public static int data6 = 6;

        public void test(){
            System.out.println("InnerClass::test()");
            System.out.println(OuterClass.this.data1);
            //或者可以在内部类里面实例化一个对象然后进行调用
            OuterClass outerClass = new OuterClass();
            System.out.println(outerClass.data1);
            System.out.println(data1);
        }
    }

    public void test(){
        System.out.println("OutClass::test()");
    }

}
